/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Model;

import java.io.Serializable;
import java.util.HashMap;

/**
 *
 * @author Anthares
 */
public class ProductBasket implements Serializable{
    private HashMap<Integer, BasketLine> lines= new HashMap<Integer, BasketLine>();

    public HashMap<Integer, BasketLine> getLines() {
        return lines;
    }

    public double getSum(){
        double sum=0;
        for(BasketLine basketLine : lines.values()){
            sum+=basketLine.getLinePrice();
        }
        return sum;
    }

    public BasketLine get(Integer key) {
        return lines.get(key);
    }

    public void put(BasketLine value) {
        lines.put(value.getKey(), value);
    }

    public void remove(Integer key) {
        lines.remove(key);
    }

    public void clear() {
        lines.clear();
    }
    public int size() {
        return lines.size();
    }
}
